from sklearn import datasets
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns

# 设置全局配置
font_size = 16
dpi = 100
linewidth = 2
params = {'axes.titlesize': font_size,
          'legend.fontsize': font_size,
          'figure.dpi': dpi,
          'figure.figsize': (8, 6),
          'axes.labelsize': font_size,
          'xtick.labelsize': font_size,
          'ytick.labelsize': font_size,
          'figure.titlesize': font_size}
plt.rcParams.update(params)
plt.rcParams["font.sans-serif"] = ["Times New Roman"]  # 设置字体
plt.rcParams["axes.unicode_minus"] = False  # 该语句解决图像中的“-”负号的乱码问题
# plt.style.use('seaborn-whitegrid')
sns.set_style("white")

if __name__ == '__main__':
    X, y = datasets.make_blobs(n_samples=3883, centers=15, cluster_std=1.5, random_state=4)

    plt.scatter(X[:, 0], X[:, 1],c='orange')
    plt.show()
    # print(X.shape)
    df = pd.DataFrame(X, columns=['x','y'])
    writer = pd.ExcelWriter(r'E:\desktop\毕业论文\xww\news_xy.xlsx')
    df.to_excel(writer, index=False)
    writer.save()


    # print(X.shape)
    # print(y.shape)